package com.sort;

public class Sort_3 {
    public static void main(String[] args) {
        int arr[]={12,43,32,643,75,4,1235,6423,12345,634,124,634,1242,63,124,784,37,967,745,957,25,354,143,74,8577,254,124};
   C.sort(arr);
   for(int data:arr){
       System.out.print(data+" ");
   }

    }
}

class C{
    public  static void sort(int []arr){
        for(int gap=arr.length/2;gap>0;gap/=2){
            for(int i=gap;i<arr.length;i++){
                for(int j=i-gap;j>=0;j-=gap){
                    if(arr[j]>arr[j+gap]){
                        int tem=arr[j];
                        arr[j]=arr[j+gap];
                        arr[j+gap]=tem;
                    }
                }
            }
        }
    }
}
